Affine systems are nonlinear systems that are linear in the input. They can be specified in multiple ways and can also be converted to other systems models.
A system specified using an ODE:
In[1]:=
AffineStateSpaceModel[mx''[t]+c[x]x'[t]+k[x]F[t],x[t],F[t],x[t],t]
Out[1]=
x.
1
[t]
x.
2
[t]
0
x.
2
[t]
-k[x]-c[x]
x.
2
[t]
m
1
m
​
x.
1
[t]
0
A system specified using its components:
In[2]:=
AffineStateSpaceModel[{{
f
1
[
x
1
,
x
2
],
f
2
[
x
1
,
x
2
]},{{
g
11
[
x
1
,
x
2
]},{
g
21
[
x
1
,
x
2
]}},{
h
1
[
x
1
,
x
2
]}},{
x
1
,
x
2
}]
Out[2]=
x
1
f
1
[
x
1
,
x
2
]
g
11
[
x
1
,
x
2
]
x
2
f
2
[
x
1
,
x
2
]
g
21
[
x
1
,
x
2
]
​
h
1
[
x
1
,
x
2
]
0
Systems obtained from other systems models:
In[3]:=
AffineStateSpaceModel/@
a
11
a
12
b
11
a
21
a
22
b
21
c
11
c
12
0
,
1
-2s+
2
s
,
x
1
f
1
[
x
1
,
x
2
]+
u
1
g
11
[
x
1
,
x
2
]
x
2
f
2
[
x
1
,
x
2
]+
u
1
g
21
[
x
1
,
x
2
]
​
h
1
[
x
1
,
x
2
]

Out[3]=

x
1
a
11
x
1
+
a
12
x
2
b
11
x
2
a
21
x
1
+
a
22
x
2
b
21
​
c
11
x
1
+
c
12
x
2
0
,
x.
1
x.
2
0
x.
2
2
x.
2
1
​
x.
1
0
,
x
1
f
1
[
x
1
,
x
2
]
g
11
[
x
1
,
x
2
]
x
2
f
2
[
x
1
,
x
2
]
g
21
[
x
1
,
x
2
]
​
h
1
[
x
1
,
x
2
]
0

A
NonlinearStateSpaceModel
that is not input linear is approximated:
In[4]:=
AffineStateSpaceModel
x
1
f
1
[
x
1
,
x
2
,
u
1
]
x
2
f
2
[
x
1
,
x
2
,
u
1
]
​
h
1
[
x
1
,
x
2
,
u
1
]

Out[4]=
x
1
f
1
[
x
1
,
x
2
,0]
(0,0,1)
f
1
[
x
1
,
x
2
,0]
x
2
f
2
[
x
1
,
x
2
,0]
(0,0,1)
f
2
[
x
1
,
x
2
,0]
​
h
1
[
x
1
,
x
2
,0]
(0,0,1)
h
1
[
x
1
,
x
2
,0]
A linear
AffineStateSpaceModel
is exactly converted to linear systems models:
In[5]:=
assm=
x
1
x
1
+
x
2
1
x
2
x
1
1
​
x
1
0
;
In[6]:=
{StateSpaceModel[assm],TransferFunctionModel[assm]}
Out[6]=

1
1
1
1
0
1
1
0
0
,
1+s.
-1-s.+
2
s.

In general, affine models are approximated during conversion to linear systems models:
In[7]:=
assm=
x
1
x
1
+
x
2
+
x
1
x
2
1
x
2
x
1
1+
x
2
​
x
1
0
;
In[8]:=
{StateSpaceModel[assm],TransferFunctionModel[assm]}
Out[8]=

1
1
1
1
0
1
1
0
0
,
1+s.
-1-s.+
2
s.

The conversion to a
NonlinearStateSpaceModel
is exact:
In[9]:=
NonlinearStateSpaceModel
x
1
f
1
[
x
1
,
x
2
]
g
11
[
x
1
,
x
2
]
x
2
f
2
[
x
1
,
x
2
]
g
21
[
x
1
,
x
2
]
​
h
1
[
x
1
,
x
2
]
0

Out[9]=
x
1
f
1
[
x
1
,
x
2
]+
u
1
g
11
[
x
1
,
x
2
]
x
2
f
2
[
x
1
,
x
2
]+
u
1
g
21
[
x
1
,
x
2
]
​
h
1
[
x
1
,
x
2
]